import React from 'react';

import { Row, Col, Button } from 'antd';
import router from 'umi/router';
import styles from './index.less';
import { showConfirm } from '@/utils/utils';

export default class AreaDisplayer extends React.PureComponent {
  state = {};

  render() {
    return (
      <>
        <Row className={styles.editFooter} align="middle" justify="center" type="flex">
          <Col md={4} sm={24}>
            <Button
              loading={this.props.loading}
              onClick={this.props.handleSavePrice}
              type="primary"
            >
              保存
            </Button>
            <Button
              onClick={this.props.handleApprove}
              className="yellow-button"
              style={{ marginLeft: 8 }}
            >
              发起审批
            </Button>
            <Button
              onClick={() =>
                showConfirm(
                  () => router.push(this.props.location.pathname.replace('/edit', '')),
                  '确定要取消编辑？',
                  '取消后本次编辑内容将不保存。',
                )
              }
              style={{ marginLeft: 8 }}
            >
              取消
            </Button>
          </Col>
        </Row>
      </>
    );
  }
}
